<%@page import="java.util.Locale"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:if test="${empty param.lang}">
    <c:if test="${pageContext.request.locale=='zh_CN'||pageContext.request.locale=='zh'}">
        <c:set var="locale" scope="session" value="zh_CN"/>
        <fmt:setLocale value="zh_CN"/>
    </c:if>
    <c:if test="${pageContext.request.locale=='zh_TW'}">
        <c:set var="locale" scope="session" value="zh_TW"/>
        <fmt:setLocale value="zh_TW"/>
    </c:if>
    <c:if test="${pageContext.request.locale=='en_US'||pageContext.request.locale=='en_GB'||pageContext.request.locale=='en'}">
        <c:set var="locale" scope="session" value="en"/>
        <fmt:setLocale value="en"/>
    </c:if>
</c:if>
<c:if test="${param.lang=='en'}">
	<c:set var="locale" scope="session" value="en"/>
	<fmt:setLocale value="en"/>
</c:if>
<c:if test="${param.lang=='zh_CN'}">
	<c:set var="locale" scope="session" value="zh_CN"/>
	<fmt:setLocale value="zh_CN"/>
</c:if>
<c:if test="${param.lang=='zh_TW'}">
	<c:set var="locale" scope="session" value="zh_TW"/>
	<fmt:setLocale value="zh_TW"/>
</c:if>

<fmt:setBundle basename="messages"/>

<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>MCU Manager</title>
<script type="text/javascript" src="<c:url value='/javascript/jquery-1.4.4.min.js'/>"></script>
<script type="text/javascript">
$(function(){
	<c:if test="${not empty param.errorcode}">
	var errorcode="${param.errorcode}";
	var error="";

	switch(errorcode){
	case "1":
		error="<fmt:message key='common.tip.username.notexist'/>";
		break;
	case "2":
		error="<fmt:message key='common.tip.wrongpwd'/>";
		break;
	case "3":
		error="<fmt:message key='common.tip.servererror'/>";
		break;
	default:
		error="<fmt:message key='common.tip.unknowerror'/>";
		break;
	}
	showError(error);
	</c:if>
});

function showError(text){
	alert(text);
}

</script>

<style>
html, body
{
    height: 100%;
    width: 100%;
}

body
{
    background-image:   url(<c:url value='/styles/default/images/map.jpg'/>) ;
    font: 13px 'Lucida Sans Unicode', 'Trebuchet MS', Arial, Helvetica;
    margin: 0;    
}

/*--------------------*/

#login
{
    background-color: #87CEEB;
    background-image: -webkit-gradient(linear, left top, left bottom, from(#87CEEB), to(#eee));
    background-image: -webkit-linear-gradient(top, #87CEEB, #eee);
    background-image: -moz-linear-gradient(top, #87CEEB, #eee);
    background-image: -ms-linear-gradient(top, #87CEEB, #eee);
    background-image: -o-linear-gradient(top, #87CEEB, #eee);
    background-image: linear-gradient(top, #87CEEB, #eee);
    height: 240px;
    width: 400px;
    margin: -150px 0 0 -230px;
    padding: 30px;
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;  
    border: 1px solid rgba(147, 184, 189,0.8);
	-webkit-box-shadow: 0pt 2px 5px rgba(105, 108, 109,  0.7),	0px 0px 8px 5px rgba(208, 223, 226, 0.4) inset;
	   -moz-box-shadow: 0pt 2px 5px rgba(105, 108, 109,  0.7),	0px 0px 8px 5px rgba(208, 223, 226, 0.4) inset;
	        box-shadow: 0pt 2px 5px rgba(105, 108, 109,  0.7),	0px 0px 8px 5px rgba(208, 223, 226, 0.4) inset;
	-webkit-box-shadow: 5px;
	-moz-border-radius: 5px;
		 border-radius: 5px;
}

/*--------------------*/


h1
{
    text-shadow: 0 1px 0 rgba(255, 255, 255, .7), 0px 2px 0 rgba(6, 106, 117, .5);
    text-transform: none;
    text-align: center;
    color: rgb(6, 106, 117);
    margin: 0 0 30px 0;
    letter-spacing: 4px;
    font-size: 38px;
    font-weight: normal;
    font-family: Cooper Black, Calibri,Arial,sans-serif;
    position: relative;
}

h1:after, h1:before
{
    background-color: rgb(6, 106, 117);
    content: "";
    height: 1px;
    position: absolute;
    top: 22px;
    width: 120px;
}

h1:after
{
    background-image: -webkit-gradient(linear, left top, right top, from(rgb(6, 106, 117)), to(#fff));
    background-image: -webkit-linear-gradient(left, rgb(6, 106, 117), #fff);
    background-image: -moz-linear-gradient(left, rgb(6, 106, 117), #fff);
    background-image: -ms-linear-gradient(left, rgb(6, 106, 117), #fff);
    background-image: -o-linear-gradient(left,rgb(6, 106, 117), #fff);
    background-image: linear-gradient(left, rgb(6, 106, 117), #fff);
    right: 0;
}

h1:before
{
    background-image: -webkit-gradient(linear, right top, left top, from(rgb(6, 106, 117)), to(#fff));
    background-image: -webkit-linear-gradient(right, rgb(6, 106, 117), #fff);
    background-image: -moz-linear-gradient(right, rgb(6, 106, 117), #fff);
    background-image: -ms-linear-gradient(right, rgb(6, 106, 117), #fff);
    background-image: -o-linear-gradient(right, rgb(6, 106, 117), #fff);
    background-image: linear-gradient(right, rgb(6, 106, 117), #fff);
    left: 0;
}

/*--------------------*/

fieldset
{
    border: 0;
    padding: 0;
    margin: 0;
}

/*--------------------*/

#inputs input
{
    background: #f1f1f1 url(<c:url value='/styles/default/images/login-sprite.png'/>) no-repeat;
    padding: 15px 15px 15px 30px;
    margin: 0 0 10px 0;
    width: 353px; /* 353 + 2 + 45 = 400 */
    border: 1px solid #ccc;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    -moz-box-shadow: 0 1px 1px #ccc inset, 0 1px 0 #fff;
    -webkit-box-shadow: 0 1px 1px #ccc inset, 0 1px 0 #fff;
    box-shadow: 0 1px 1px #ccc inset, 0 1px 0 #fff;
}

#username
{
    background-position: 5px -2px !important;
}

#password
{
    background-position: 5px -52px !important;
}

#inputs input:focus
{
    background-color: #fff;
    border-color: #e8c291;
    outline: none;
    -moz-box-shadow: 0 0 0 1px #e8c291 inset;
    -webkit-box-shadow: 0 0 0 1px #e8c291 inset;
    box-shadow: 0 0 0 1px #e8c291 inset;
}

/*--------------------*/
#actions
{
    margin: 25px 0 0 0;
}

#submit
{
    background-color: #ffb94b;
    background-image: -webkit-gradient(linear, left top, left bottom, from(#fddb6f), to(#ffb94b));
    background-image: -webkit-linear-gradient(top, #fddb6f, #ffb94b);
    background-image: -moz-linear-gradient(top, #fddb6f, #ffb94b);
    background-image: -ms-linear-gradient(top, #fddb6f, #ffb94b);
    background-image: -o-linear-gradient(top, #fddb6f, #ffb94b);
    background-image: linear-gradient(top, #fddb6f, #ffb94b);

    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;

    text-shadow: 0 1px 0 rgba(255,255,255,0.5);

     -moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
     -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;
     box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3) inset;

    border-width: 1px;
    border-style: solid;
    border-color: #d69e31 #e3a037 #d5982d #e3a037;

    float: left;
    height: 35px;
    padding: 0;
    width: 120px;
    cursor: pointer;
    font: bold 15px Arial, Helvetica;
    color: #8f5a0a;
}

#submit:hover,#submit:focus
{
    background-color: #fddb6f;
    background-image: -webkit-gradient(linear, left top, left bottom, from(#ffb94b), to(#fddb6f));
    background-image: -webkit-linear-gradient(top, #ffb94b, #fddb6f);
    background-image: -moz-linear-gradient(top, #ffb94b, #fddb6f);
    background-image: -ms-linear-gradient(top, #ffb94b, #fddb6f);
    background-image: -o-linear-gradient(top, #ffb94b, #fddb6f);
    background-image: linear-gradient(top, #ffb94b, #fddb6f);
}

#submit:active
{
    outline: none;

     -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
     -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
     box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
}

#submit::-moz-focus-inner
{
  border: none;
}

#actions a
{
    color: #3151A2;
    float: right;
    line-height: 35px;
    margin-left: 10px;
}

#actions div
{
    color: #3151A2;
    float: right;
    line-height: 35px;
    margin-left: 10px;
}

/*--------------------*/

#version
{
    display: block;
    text-align: center;
    position: relative;
    top: 60px;
    color: #999;
}


</style>
</head>

<body>
<form id="login" method="post" action="app/perm/login">
    <h1><fmt:message key="login.title" /></h1>
    <fieldset id="inputs">
        <input  name="username" id="username" type="text" placeholder="<fmt:message key="login.username" />" autofocus required>
        <input  name="pwd" id="password" type="password" placeholder="<fmt:message key="login.password" />" required>
    </fieldset>
    <fieldset id="actions">
        <input type="submit" id="submit" value="<fmt:message key="login" />">
        <a href="<c:url value='/index.jsp?lang=en' />">English</a><div>|</div>
        <a href="<c:url value='/index.jsp?lang=zh_CN' />">简体中文</a>
    </fieldset>
        <a href="http://www.agilevideo.net" id="version"><fmt:message key="common.copyright" /></a>
</form>
</body>
</html>
